package cn.tedu.eb_film.service.impl;

import cn.tedu.eb_film.mapper.ServiceCinemaMapper;
import cn.tedu.eb_film.pojo.dto.ServiceCinemaDto;

import cn.tedu.eb_film.pojo.dto.ServiceCinemaUpdateDto;
import cn.tedu.eb_film.pojo.entity.ServiceCinema;
import cn.tedu.eb_film.pojo.vo.ServiceCinemaVo;
import cn.tedu.eb_film.service.ServiceCinemaService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Service
public class ServiceCinemaImp implements ServiceCinemaService {

    @Autowired
    ServiceCinemaMapper serviceCinemaMapper;
    /**
     * 添加新的电影院服务
     * @param serviceCinemaDto
     */
    @Override
    public void AddCinemaService(ServiceCinemaDto serviceCinemaDto) {
      ServiceCinema serviceCinema = new ServiceCinema();
        BeanUtils.copyProperties(serviceCinemaDto,serviceCinema);
        serviceCinema.setCreateTime(LocalDateTime.now());
        serviceCinema.setUpdateTime(LocalDateTime.now());
            serviceCinemaMapper.AddCinemaService(serviceCinema);
    }

    /**
     * 批量添加电影院服务
     * @param list
     */
    @Override
    public void AddCinemaServiceList(List<ServiceCinema> list) {
        serviceCinemaMapper.AddCinemaServiceList(list);
    }

    /**
     * 根据id删除电影院服务
     * @param id
     */
    @Override
    public void DeleteCinemaServiceById(Long id) {
        serviceCinemaMapper.DeleteCinemaServiceById(id);
    }

    @Override
    public void DeleteCinemaServiceByIds(List<Long> list) {
        serviceCinemaMapper.DeleteCinemaServiceByIds(list);
    }

    @Override
    public void CountServiceCinema() {
        serviceCinemaMapper.CountServiceCinema();
    }

    @Override
    public ServiceCinemaVo GetServiceCinemaById(Long id) {
        return serviceCinemaMapper.GetServiceCinemaById(id);
    }

    @Override
    public List<ServiceCinemaVo> GetServiceCinemaList() {
        return serviceCinemaMapper.GetServiceCinemaList();
    }

    @Override
    public void updateServiceCinema(ServiceCinemaUpdateDto serviceCinemaUpdateDto) {
        serviceCinemaMapper.updateServiceCinema(serviceCinemaUpdateDto);
    }
}
